/*7:定义两个递增有序的数组,把其合并成一个数组,并保证其仍然是有序的.
 比如,数组{1,3,5}和{2,4,6,8},合并后是{1,2,3,4,5,6,8}
提示:新数组长度是两者的和,判断每一个数是大是小,放入新数组中*/
package ZUOYE0424;

import java.util.Scanner;

public class Task7之作业更改 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int j[] = new int[10];
		int k[] = new int[10];
		int arr[] = new int[j.length + k.length];
		System.out.println("输入第一组数：");
		for (int a = 0; a < j.length; a++) {
			j[a] = in.nextInt();
		}
		System.out.println("输入第二组数：");
		for (int b = 0; b < k.length; b++) {
			k[b] = in.nextInt();
		}
		int d = 0, e = 0, f = 0;
		while (e < j.length && f < k.length) {
			if (j[e] <= k[f]) {
				arr[d] = j[e];
				e++;
				d++;
			} else {
				arr[d] = k[f];
				f++;
				d++;
			}
		}
		while (e < j.length)
			arr[d++] = j[e++];
		while (f < k.length)
			arr[d++] = k[f++];
		for (int p = 0; p < arr.length; p++) {
			System.out.println(arr[p]);
		}

	}
}